package wiki.tools.vidition.droid;

import java.util.ArrayList;
import wiki.tools.vidition.droid.util.bean.CategoryBean;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ShowCategroyAdapter extends BaseAdapter {
	private LayoutInflater layoutInflater;
	private ArrayList<CategoryBean> categroy;

	public ShowCategroyAdapter(Context c, ArrayList<CategoryBean> categroy) {
		layoutInflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.categroy = categroy;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return categroy.size();
	}

	public CategoryBean getItem(int position) {
		return categroy.get(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {

		if (null == convertView) {
			convertView = layoutInflater.inflate(R.layout.showcategroyadapter,
					parent, false);
		}
		TextView title = (TextView) convertView
				.findViewById(R.id.categroy_title);
		TextView desc = (TextView) convertView.findViewById(R.id.categroy_desc);
		CategoryBean bean = getItem(position);
		title.setText(bean.title);
		desc.setText(bean.time);
		return convertView;
	}

}
